import java.math.BigInteger;
import java.util.Scanner;

public class JULKA {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int testcases = 10;
		BigInteger total, difference, nataliaApple, KlaudiaApple;
		while (testcases-- > 0) {
			total = in.nextBigInteger();
			difference = in.nextBigInteger();
			nataliaApple = total.subtract(difference);
			nataliaApple = nataliaApple.divide(BigInteger.valueOf(2));
			KlaudiaApple = nataliaApple.add(difference);
			System.out.println(KlaudiaApple);
			System.out.println(nataliaApple);
		}
	}
}
